package com.zhiwang.planet.ui.my.message

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import com.zhiwang.planet.R
import com.zhiwang.planet.databinding.FragmentActivityBinding
import com.zhiwang.planet.databinding.FragmentSystemNotificationBinding
import com.zhiwang.planet.di.component.DaggerAccountComponent
import com.zhiwang.planet.di.module.AccountModule
import com.zhiwang.planet.di.module.AutoDisposeModule
import com.zhiwang.planet.mvvm.viewmodel.ActivityViewModel
import com.zhiwang.planet.mvvm.viewmodel.SystemNotificationViewModel
import com.zhiwang.planet.ui.BaseFragment
import com.zhiwang.planet.ui.my.record.CommonRecordAdapter
import javax.inject.Inject

class SystemNotificationFragment : BaseFragment() {



    @Inject
    lateinit var activityViewModel: SystemNotificationViewModel


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        DaggerAccountComponent.builder()
                .accountModule(AccountModule(context as AppCompatActivity))
                .appComponent(getAppComponent())
                .autoDisposeModule(AutoDisposeModule(this))
                .build()
                .inject(this)
    }

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
                              savedInstanceState: Bundle?): View? {

        val view = inflater.inflate(R.layout.fragment_system_notification, container, false)
        val binding = DataBindingUtil.bind<FragmentSystemNotificationBinding>(view)
        binding?.viewModel = activityViewModel
        binding?.lifecycleOwner = viewLifecycleOwner
        return view
    }


    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)
        activityViewModel.load()
    }


}